package domain

import (
	"github.com/lab-online/internal/class/entity"
	"github.com/lab-online/internal/class/interface/include"
	"github.com/lab-online/internal/shared/valueobject"
	"github.com/lab-online/pkg/auth"
)

type ClassDomain interface {
	CreateClass(entity.ClassEntity, auth.AuthEntity) (entity.ClassEntity, error)
	SearchClass(entity.ClassEntity, auth.AuthEntity) ([]entity.ClassEntity, error)
	RemoveClass(entity.ClassEntity, auth.AuthEntity) error
	UpdateClass(entity.ClassEntity, auth.AuthEntity) error
	GetClass(entity.ClassEntity, auth.AuthEntity) (entity.ClassEntity, error)

	GetClassStudent(entity.ClassEntity, auth.AuthEntity) (entity.ClassEntity, error)
	UpdateStudent(
		[]valueobject.PatchVO, entity.ClassEntity, auth.AuthEntity,
	) (entity.ClassEntity, error)
}

type Domain struct {
	repository       ClassRepository
	courseRepository include.CourseRepository
	userRepository   include.UserRepository
}

func New(
	repository ClassRepository,
	courseRepository include.CourseRepository,
	userRepository include.UserRepository,
) ClassDomain {
	return &Domain{repository, courseRepository, userRepository}
}
